﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Service;
using MODEL;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Messaging;
using System.Windows.Input;
using GalaSoft.MvvmLight.Command;
using Common;

namespace ViewModel.StationControl
{
    public class ValveControlRecordViewModel : ViewModelBase
    {
        private List<ValveControl> m_ControlValueList;
        public List<ValveControl> ControlValueList {
            get { return this.m_ControlValueList; }
            set { this.m_ControlValueList = value; base.RaisePropertyChanged(() => this.ControlValueList); }
        }

        private IValveControlService m_ControlValueService;

        public ValveControlRecordViewModel(IValveControlService controlValueService)
        {
            this.m_ControlValueService = controlValueService;
            RefreshData();
        }

        public async void RefreshData()
        {
            this.ControlValueList = (await this.m_ControlValueService.QueryControlValues(new ValveControlQueryCriteria { UserId = AppSetting.Instance.User.UserId })).ToList();
        }
    }
}
